/*
 * @(#)Singleton.java    Aug 16, 2010
 *
 * Copyright 2009 Nyber Shanghai, Inc. All rights reserved.
 */

package com.lab.basic;

/**
 * Class description goes here.
 *
 * @author nickevin@gmail.com
 * @version Aug 16, 2010 8:10:11 PM
 */

public class InnerClassSingleton {

    // Private constructor prevents instantiation from other classes
    private InnerClassSingleton() {}

    /**
     * SingletonHolder is loaded on the first execution of Singleton.getInstance() 
     * or the first access to SingletonHolder.INSTANCE, not before.
     */
    private static class SingletonHolder {
        private static final InnerClassSingleton INSTANCE = new InnerClassSingleton();
    }

    public static InnerClassSingleton getInstance() {
        return SingletonHolder.INSTANCE;
    }
}
